Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - vikti

Pages: [1]
1
NGUI 3 Support / Detect widget collision
« on: February 27, 2015, 05:00:14 PM »
Hello,

I have a map with UIWidget markers. I need to detect collision between them (eg : MarkerPlayer entering GruntPlayer) and detect click, drag, etc...

So each of my marker have a rigidbody and a collider. But it does not fire anymore any OnClick or other "regular" events.

Others infos :
-each collider has 0 on z size.
-I use a modified version of UITriggerEvent but it works well when I remove the rigidbody
-Does not work with UICamera set to 3D UI neither 3D world.
-All my markers are anchored to external gameobjects.
-collider's IsTrigger = true;

Where I am wrong ?

2
NGUI 3 Support / SetAnchor without affecting scale.
« on: February 12, 2015, 06:23:57 AM »
Hello,

I add ngui prefabs dynamically that I have to anchor on regular gameobject outside the UIRoot. (They are some map markers).
The problem is that this gameobject as a World scale of 1.
So when I do the Anchor, the UIWidget size go from 80 to 2.
I tried to reset the UIWidget size to 80 (the original size) after the anchoring, but this makes offset my UIWidget out of the Panel...

I read the doc and, indeed, the target affect the actual UIrectangle.

So, what is the correct way to anchor a object with a UIRoot outside GO without affecting its scale?
         

3
NGUI 3 Support / Compute mesh inertia tensor failed with AddChild
« on: February 11, 2015, 05:42:42 PM »
I have some exceptions that I don't understand.

  1. Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually!
  2.  

This is thrown by :

  1. MapUIRoot = Resources.Load("Components/com_map/Views/Templates/_mapUIRoot") as GameObject;
  2. GameObject MapLayer  = Resources.Load("Components/com_map/Views/Templates/_mapLayer") as GameObject;
  3.  
  4. MapLayer = NGUITools.AddChild(gameObject,MapLayer);

How can I solve this ?


4
NGUI 3 Support / Data binding on non monobehaviour
« on: December 18, 2014, 05:33:30 PM »
Hello,

I wonder how to do a data binding on a non behaviour class.

Ex :

  1.         public class Item{
  2.                 public int Id {get;set;}
  3.                 public Vector2 GeoCoord{get;set;}
  4.                 public string State{get;set;}
  5.                 public string Name{get;set;}
  6.                 public Type Type{get;set;}
  7.                 public string Icon{get;set;}
  8.                 public int Aura{get;set;}
  9.                 public Dictionary<string, int> GOInstanceId{get;set;}
  10.                 private int ownerId;
  11.                 public int OwnerId{
  12.                         get{
  13.                                 return ownerId;
  14.                         }
  15.                         set{
  16.                                 ownerId = value;
  17.                                 switch(ownerId){
  18.                                         case -1 :       State = "deleted";
  19.                                                                 break;
  20.                                         case 0  :       State = "invisible";
  21.                                                                 break;
  22.                                         case 1  :       State = "free";
  23.                                                                 break;
  24.                                         default :       State = "owned";
  25.                                                                 break;
  26.                                 }
  27.                         }
  28.                 }
  29.                 public Item (){
  30.                         GOInstanceId = new Dictionary<string,int>();
  31.                 }
  32.         }

Then I have some view elements : map markers, details info panels with input text, labels...

Is it possible to link this element with the model ?

5
NGUI 3 Support / [SOLVED]UICamera.onClick does not exist...i
« on: December 17, 2014, 02:24:48 PM »
Hi,

I try to set an event delegate but I have the bellow error

  1. Assets/Libraries/Wizar/UIInteraction/OpenBottomSheet.cs(30,62): error CS1061: Type `UICamera' does not contain a definition for `OnClick' and no extension method `OnClick' of type `UICamera' could be found (are you missing a using directive or an assembly reference?)
  2.  

Here is my code :

  1. using UnityEngine;
  2. using System.Collections;
  3. using Wizar;
  4.  
  5. public class OpenBottomSheet : MonoBehaviour {
  6.  
  7.         private Transform _tweenTarget;
  8.         private bool _isDisplayed = false;
  9.         public Vector3 hover = Vector3.zero;
  10.         public Vector3 pressed = new Vector3(0f, 150f);
  11.         public float duration = 0.2f;
  12.  
  13.         Vector3 mPos;
  14.         bool mStarted = false;
  15.  
  16.         void Start(){
  17.                 _tweenTarget = transform.GetChild(1);
  18.  
  19.                 if (!mStarted)
  20.                 {
  21.                         mStarted = true;
  22.                         mPos = _tweenTarget.localPosition;
  23.                 }
  24.         }
  25.  
  26.         // Shout that a new bottom sheet is going to be opened
  27.         void OnEnable () {
  28.                 MapEventsManager.Trigger("OnOpeningBottomSheet");
  29.                 MapEventsManager.OnOpeningBottomSheet += Close;
  30.                 UICamera.mainCamera.GetComponent<UICamera>().onClick += Open;
  31.         }
  32.        
  33.         void OnDisable () {
  34.                 MapEventsManager.OnOpeningBottomSheet -= Close;
  35.                 UICamera.mainCamera.GetComponent<UICamera>().onClick -= Open;
  36.         }
  37.  
  38.         void Open(){
  39.                 if (!_isDisplayed){
  40.                         TweenPosition.Begin(_tweenTarget.gameObject, duration, mPos + pressed).method = UITweener.Method.EaseInOut;
  41.                         _isDisplayed = true;
  42.                 }
  43.         }
  44.  
  45.         void Close(){
  46.                 if (_isDisplayed){
  47.                         TweenPosition.Begin(_tweenTarget.gameObject, duration, mPos).method = UITweener.Method.EaseInOut;
  48.                         _isDisplayed = false;
  49.                 }
  50.         }
  51.  
  52. }
  53.  

I tried with Onclick and onClick.

I am new to delegate stuff...

6
NGUI 3 Support / [resolved]Setting Anchor through code reset UISprite size
« on: December 01, 2014, 01:20:31 PM »
Hellon

I attempt to dynamically add markers on a map.

My marker is a prefab with a UISprite component. It has a 120*120 size

I do :
  1.         GameObject UIMarker = NGUITools.AddChild(MapComponentPanel, markerPrefab);
  2.         UIMarker.GetComponent<UISprite>().SetAnchor(markerDummy.transform);

At runtime the sprite size is reseted to 2*2.

What is the right way to add a child and to anchor it while keeping the size of the prefab ?

7
NGUI 3 Support / Load atlas, make a sprite and add to hierarchie
« on: December 01, 2014, 03:14:05 AM »
Hi,

I am looking for a good code example to :

1- Load an atlas in Resource by its name
2- create a new sprite (or widget, what is the best here, drawcalling speaking ?) using the sprite name.
3- Attach to the hierarchy.

This will be in a loop to create hundred of icons on a map.

I need help for the two first steps. Thanks for your time :)

8
TNet 3 Support / TNET for mobile MMO in offline mode
« on: September 12, 2014, 04:59:09 AM »
Hi,

I wonder if TNET could fit my needs.

I am working on a MMO for mobile. I have :
- a WorldServerModel which is the representation of all objects (monster, player, items...) on the whole map.
- a LocalWorldModel which is the representation of all objects in a specific region around the player.
- a PlayerWorldModel which is the representation of all objects concerning the player in a specific region around the player (leveled monster, equipable item, pickable resource...)
- MapModels, InventoryModels, etc... representing objects concerning the player and formated for different Views (I also work with NGUI databinding)

I want my game to be playable in offline mode :
- The player picks, drop, sell, craft... items available in his LocalWorldModel
- Once online, the LocalWorldModel syncs with WorldServerModel to add the modification.

I also want my game to be playable in online mode :
- The player picks, drop, sell, craft... items available in his LocalWorldModel
- LocalWorldModel WorldServerModel syncs like any other online game.

Do you think TNET could be usable for the two cases ?

Regards

9
NGUI 3 Support / Material Design - how to do a ink element animation ?
« on: August 26, 2014, 10:21:42 AM »
Hello,

I want to create some assets based on Google's material design specs.

I would like to recreate the material response behavior on a touch event. It is simply a round colored shape scaling to reach the maximum size of a sprite.

I am stuck on a little thing. I can't create a round shape in Unity !

So is there a way with little performance footprint to generate a a round vector shape with NGUI ?

10
NGUI 3 Support / NGUI/NDATA data binding features.
« on: August 20, 2014, 11:03:18 AM »
Hello,

what are the differences between the native data bindings feature of NGUI and the NDATA plugin ? Are they overlaping totaly ? Is NDATA is stille needed for a MVVM pattern ?

Regards

Pages: [1]